<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>主页面</title>
</head>
<body >
  <center>
    <h1>所有用户数据</h1>
    <table border="1px">
      <tr>
        <th>id</th>
        <th>名称</th>
        <th>密码</th>
        <th>年龄</th>
        <th>电话</th>
        <th>邮箱</th>
        <th>所属部门</th>
        <th>操作</th>
      </tr>
      <tr th:each="user:${users}">
        <td th:text="${user.id}">id</td>
        <td th:text="${user.username}">名称</td>
        <td th:text="${user.password}">密码</td>
        <td th:text="${user.age}">年龄</td>
        <td th:text="${user.phone}">电话</td>
        <td th:text="${user.email}">邮箱</td>
        <td th:each="dept:${user.depts}" th:text="${dept.name}" th:value="${dept.id}"></td>
        <td >
          <a th:href="${context}+'/user/toUpdate.do?id='+${user.id}">修改</a>
          <a th:href="${context}+'/user/delete.do?id='+${user.id}">删除</a>
        </td>
      </tr>
    </table>
  </center>
</body>
</html>